package com.neulogistics.contrib.warehouse.api.application.converter;

import com.neulogistics.contrib.warehouse.api.application.query.CirculationOrderQuery;
import com.neulogistics.contrib.warehouse.infrastructure.persistence.orm.po.CirculationOrderPO;
import org.springframework.beans.BeanUtils;

public class CirculationOrderQueryPOConverter {
    public static CirculationOrderPO queryToPO(CirculationOrderQuery circulationOrderQuery){
        if(circulationOrderQuery == null){
            return null;
        }

        CirculationOrderPO circulationOrderPO = new CirculationOrderPO();

        BeanUtils.copyProperties(circulationOrderQuery, circulationOrderPO);

        circulationOrderPO.setCirculationStatus(null);

        if(circulationOrderQuery.circulationDetail == -1){
            circulationOrderPO.setCirculationDetail(null);
        }

        return circulationOrderPO;
    }
}
